package Day12;

import java.util.Scanner;

public class Text2 {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws UsernameException,BadException{
        Girl g1 = new Girl();
        while (true) {
            try {
                System.out.println("请输入名字");
                String name = sc.nextLine();
                g1.setName(name);
                System.out.println("请输入年龄");
                String str = sc.nextLine();
                int age = Integer.parseInt(str);
                g1.setAge(age);
                break;
            } catch (UsernameException e) {
                e.printStackTrace();
            } catch (BadException e) {
                e.printStackTrace();
            }
        }
        System.out.println("女朋友的姓名" + g1.getName()+ "  , 女朋友的年龄" + g1.getAge());


    }
}
